'use strict';
// spu_detail表
module.exports = app => {
  const { STRING, TEXT, BIGINT } = app.Sequelize;

  const MallSpuDetail = app.model.define('mall_spu_detail', {
    spu_id: {
      type: BIGINT(20),
      allowNull: false,
      comment: 'SPU Id',
    },
    description: {
      type: TEXT,
      comment: '商品描述信息',
    },
    generic_spec: {
      type: STRING(2048),
      allowNull: false,
      defaultValue: '',
      comment: '通用规格键值对 (json格式)',
    },
    special_spec: {
      type: STRING(1024),
      allowNull: false,
      defaultValue: '',
      comment: '特有规格可选值 (json格式)',
    },
    packing_list: {
      type: STRING(1024),
      defaultValue: '',
      comment: '包装清单',
    },
    after_service: {
      type: STRING(1024),
      defaultValue: '',
      comment: '售后服务',
    },

  });

  // MallSpecParam.associate = () => {
  //   // 存在多对一关系，所以使用belongsTo()
  //   MallSpecParam.associate = () => {
  //     app.model.MallSpecParam.belongsTo(app.model.MallCategory, { foreignKey: 'category_id' });
  //   };
  //   MallSpecParam.associate = () => {
  //     app.model.MallSpecParam.belongsTo(app.model.MallSpecGroup, { foreignKey: 'group_id' });
  //   };
  // };
  return MallSpuDetail;
};
